package com.mcarrot.site.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.mcarrot.site.common.Constants;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport implements Constants{

	private static final long serialVersionUID = -4407711220965690595L;
	
	protected HttpServletResponse getResponse(){
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setContentType("application/json;charset=UTF-8"); 
		response.setCharacterEncoding("UTF-8");
		return response;
	}

	protected HttpServletRequest getHttpRequest(){
		return ServletActionContext.getRequest(); 
	}
	
	
	protected Map getSession(){
		ActionContext context =  ActionContext.getContext();
		Map session = context.getSession();
		return session;
	}
}
